home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / Framewrk / FWWindow / FWWindow.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  6.5 KB  |  237 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWWindow.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9. //    FW_CWindow: Wrapper for a ODWindow.
  10. //    
  11. //        Every FW_CFrame object has a FW_CWindow object associated with it. When 
  12. //        FW_CFrame::FacetAdded (not FrameAdded) is called, a new FW_CWindow object is created 
  13. //        if the frame doesn't already have one. The FW_CWindow is automatically deleted when
  14. //        FW_CFrame::FrameRemoved is called.
  15. //
  16. //        You should never directly create a FW_CWindow, ODF will create it for you.
  17. //
  18. #ifndef FWWINDOW_H
  19. #define FWWINDOW_H
  20.  
  21. #ifndef SLWINDOW_H
  22. #include "SLWindow.h"
  23. #endif
  24.  
  25. // ----- OS Includes -----
  26.  
  27. #ifndef FWRECT_H
  28. #include "FWRect.h"
  29. #endif
  30.  
  31. #ifndef SLGDEV_H
  32. #include "SLGDev.h"
  33. #endif
  34.  
  35. // ----- Foundation Layer -----
  36.  
  37. #ifndef FWEXCLIB_H
  38. #include "FWExcLib.h"
  39. #endif
  40.  
  41. #ifndef FWRUNTYP_H
  42. #include "FWRunTyp.h"
  43. #endif
  44.  
  45. // ----- OpenDoc Includes -----
  46.  
  47. #ifndef FWODTYPS_H
  48. #include "FWODTyps.h"
  49. #endif
  50.  
  51. #ifndef SOM_ODWindow_xh
  52. #include <Window.xh>
  53. #endif
  54.  
  55. //========================================================================================
  56. //    Forward Declarations
  57. //========================================================================================
  58.  
  59. class FW_CPart;
  60. class FW_CPresentation;
  61. class ODFrame;
  62. class FW_CString;
  63. struct WindowProperties;
  64. class ODSession;
  65.  
  66. //========================================================================================
  67. //    class FW_CWindow
  68. //========================================================================================
  69.  
  70. class FW_CWindow
  71. {
  72. public:
  73.     FW_DECLARE_CLASS
  74.     
  75. //----------------------------------------------------------------------------------------
  76. //    Constructors/Destructor
  77. //
  78. public:
  79.     
  80.     FW_CWindow(Environment* ev, 
  81.                 FW_CPart* thePart,
  82.                 ODTypeToken viewType,
  83.                 FW_CPresentation* presentation,
  84.                 const FW_CPoint& interiorSize,        // in pixels
  85.                 const FW_CPoint& position,            // in pixels
  86.                 FW_WindowStyle style);
  87.         // for document window
  88.                 
  89.     FW_CWindow(Environment* ev, 
  90.                 FW_CPart* thePart,
  91.                 ODFrame* parentFrame,
  92.                 FW_Boolean persistent,
  93.                 ODTypeToken viewType,
  94.                 FW_CPresentation* presentation,
  95.                 const FW_CString& defaultTitle,
  96.                 const FW_CPoint& interiorSize,        // in pixels
  97.                 const FW_CPoint& position,            // in pixels
  98.                 FW_WindowStyle style);
  99.         // for View As Window
  100.                 
  101.     FW_CWindow(Environment* ev, 
  102.                 ODFrame* odFrame);
  103.         // Creates a window from a frame
  104.                 
  105.     FW_CWindow(Environment* ev, 
  106.                 ODID windowID);
  107.         // Create a window for non-root frame
  108.                 
  109.     virtual ~FW_CWindow();
  110.         
  111. //----------------------------------------------------------------------------------------
  112. //    From ODWindow (inlines)
  113. //
  114. public:
  115.     FW_Boolean                    IsActive(Environment *ev) const;
  116.     ODPlatformWindow            GetPlatformWindow(Environment *ev) const;
  117.  
  118.     virtual void                Select(Environment *ev) const;
  119.  
  120.     virtual FW_Boolean            IsFloating(Environment* ev) const;
  121.  
  122.     virtual void                Close(Environment *ev);
  123.     virtual void                CloseAndRemove(Environment *ev);
  124.  
  125.  
  126.     virtual void                Show(Environment* ev);
  127.     virtual void                 Hide(Environment* ev);
  128.     FW_Boolean                     IsShown(Environment* ev) const;
  129.  
  130. //----------------------------------------------------------------------------------------
  131. //    New API
  132. //
  133. public:
  134.     virtual ODID                GetID(Environment *ev) const;
  135.     virtual void                SetID(Environment *ev, ODID windowID);
  136.  
  137.     virtual ODWindow*            AcquireODWindow(Environment *ev) const;
  138.     
  139.     // ----- Show/Hide -----
  140.     void                        ShowHide(Environment* ev, 
  141.                                     FW_Boolean state);
  142.     
  143.     // ----- Graphic Device -----
  144.     FW_HGDevice                    GetGraphicDevice(Environment* ev) const;
  145.     
  146.     // ----- Window Title -----
  147.     void                        GetWindowTitle(Environment* ev, 
  148.                                     FW_CString& windowTitle) const;
  149.     void                        SetWindowTitle(Environment* ev, 
  150.                                     const FW_CString& windowTitle);
  151.     
  152.     // ----- Window Geometry -----
  153.     void                        SetWindowSize(Environment* ev, 
  154.                                     const FW_CPoint& interiorSize);
  155.     void                        SetWindowPosition(Environment* ev,
  156.                                     const FW_CPoint& newPosition);
  157.     
  158.     void                        GetWindowSize(Environment* ev, 
  159.                                     FW_CPoint& interiorSize) const;
  160.     void                        GetWindowPosition(Environment* ev, 
  161.                                     FW_CPoint& position) const;
  162.                                     
  163.     void                        GetBorderSize(Environment* ev,
  164.                                     FW_CRect& borderSize) const;
  165.     
  166.     void                        FitToScreen(Environment* ev);
  167.     
  168.     // ----- Coordinate Conversion -----
  169.     void                        WindowToScreen(Environment* ev,
  170.                                     FW_CPoint* points, 
  171.                                     unsigned short nbPoint = 1);
  172.     void                        ScreenToWindow(Environment* ev,
  173.                                     FW_CPoint* points, 
  174.                                     unsigned short nbPoint = 1);
  175.  
  176.     void                        WindowToScreen(Environment* ev,
  177.                                     FW_CRect& rect)
  178.                                     {WindowToScreen(ev, (FW_CPoint*)&rect, 2);}
  179.     void                        ScreenToWindow(Environment* ev,
  180.                                     FW_CRect& rect)
  181.                                     {ScreenToWindow(ev, (FW_CPoint*)&rect, 2);}
  182.                                     
  183. //----------------------------------------------------------------------------------------
  184. //    Internal Only
  185. //
  186. public:
  187. #ifdef FW_BUILD_MAC    
  188.     // ----- Mac Window Zooming -----
  189.     void                        PrivMacDoZoom(Environment* ev, 
  190.                                     const FW_CPoint& zoomedSize, 
  191.                                     const FW_CRect& borderSize,
  192.                                     const FW_CRect& screenRect,
  193.                                     unsigned long message);
  194. #endif
  195.  
  196.     // ----- ODWindow creation -----
  197.     void                        PrivOpenWindow(Environment* ev,
  198.                                     ODWindow* odWindow);
  199.  
  200.     ODWindow*                    PrivCreateODWindow(Environment* ev, 
  201.                                     FW_CPart* thePart,
  202.                                     ODFrame* parentFrame,
  203.                                     FW_Boolean persistent,
  204.                                     ODTypeToken viewType,
  205.                                     FW_CPresentation* presentation,
  206.                                     const FW_CString& windowTitle,
  207.                                     const FW_CPoint& interiorSize,
  208.                                     const FW_CPoint& position,
  209.                                     FW_WindowStyle style);
  210.  
  211.     void                        PrivCreateODWindowForFrame(Environment* ev, 
  212.                                     ODFrame* odFrame);
  213.     
  214. //----------------------------------------------------------------------------------------
  215. //    Data Members
  216. //
  217. protected:
  218.     ODID                        fWindowID;
  219.         
  220. private:
  221.     FW_HGDevice                    fGraphicDevice;
  222. };
  223.  
  224. //========================================================================================
  225. //    Inlines
  226. //========================================================================================
  227.  
  228. //----------------------------------------------------------------------------------------
  229. // FW_CWindow::ShowHide
  230. //----------------------------------------------------------------------------------------
  231. inline void FW_CWindow::ShowHide(Environment* ev, FW_Boolean state)
  232. {
  233.     state ? Show(ev) : Hide(ev);
  234. }
  235.  
  236. #endif
  237.